/*
 * @Author: your name
 * @Date: 2021-04-09 15:13:20
 * @LastEditTime: 2021-04-09 15:41:41
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /vite-project/src/utils/http/axiosCancel.ts
 */

import axios, { AxiosRequestConfig, Canceler } from 'axios';
import qs from 'qs';
import { isFunction } from '@/utils/is/index';

export const getPendingUrl = (config: AxiosRequestConfig) =>
    [
        config.method,
        config.url,
        qs.stringify(config.data),
        qs.stringify(config.params),
    ].join('&');

export class AxiosCanceler {
    /**
     * @description: 添加请求
     * @param {AxiosRequestConfig} config
     * @return {*}
     */
    addPending(config: AxiosRequestConfig) {
        this.removePending(config);
        const url = getPendingUrl(config);
    }

    /**
     * @description: 移除请求
     * @param {AxiosRequestConfig} config
     * @return {*}
     */
    removePending(config: AxiosRequestConfig) {}
}
